package com.code.zjm.demo.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.ArrayAdapter;
import android.widget.Gallery;

/**
 * Created by ZJM on 2017/3/4.
 */
public class AtyShowGallery extends AppCompatActivity {
    private Gallery galleryUI;
    private ArrayAdapter<String> adapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gallery);

        galleryUI = (Gallery) findViewById(R.id.galleryUI);
        adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1);
        galleryUI.setAdapter(adapter);
        for (int i = 0; i < 20; i++) {
            adapter.add("gallery" + i);
        }

    }
}
